<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <!-- Constants -->
    <constant name="struts.devMode" value="false"/>
    <constant name="struts.i18n.encoding" value="UTF-8"/>
    <constant name="struts.action.extension" value="action"/>
    <constant name="struts.objectFactory" value="spring"/>
    <constant name="struts.custom.i18n.resources" value="ApplicationResources,errors"/>
    <constant name="struts.multipart.maxSize" value="10097152"/>
    <constant name="struts.ui.theme" value="css_xhtml"/>
    <constant name="struts.codebehind.pathPrefix" value="/WEB-INF/pages/"/>
    <constant name="struts.enable.SlashesInActionNames" value="true"/>
    <constant name="struts.convention.action.disableScanning" value="true"/>
    <constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>



    <!-- Configuration for the default package. -->
    <package name="default" extends="struts-default">
        <interceptors>
            <!-- Interceptor to handle allowing only admins to certain actions -->
            <interceptor name="adminOnly" class="adminInterceptor"/>
            <!-- Copied from struts-default.xml and changed validation exclude methods -->
            <interceptor-stack name="defaultStack">
                <interceptor-ref name="exception"/>
                <interceptor-ref name="alias"/>
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain"/>
                <interceptor-ref name="debugging"/>
                <interceptor-ref name="profiling"/>
                <interceptor-ref name="scopedModelDriven"/>
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="params">
                    <param name="excludeParams">dojo\..*</param>
                </interceptor-ref>
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">cancel,execute,delete,refreshPageContent,edit,list,save,saveMyInfo,saveStaff,saveChannelUser,saveStory,checkServerName</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
            </interceptor-stack>
            <interceptor-stack name="fileUploadStack">
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
            <interceptor-stack name="adminCheck">
                <interceptor-ref name="defaultStack"/>
                <interceptor-ref name="adminOnly"/>
            </interceptor-stack>
        </interceptors>

        <global-results>
            <result name="index" type="redirectAction">index</result>
            <result name="dataAccessFailure">/WEB-INF/pages/dataAccessFailure.jsp</result>
        </global-results>

        <global-exception-mappings>
            <exception-mapping exception="org.springframework.dao.DataAccessException" result="dataAccessFailure"/>
        </global-exception-mappings>

        <action name="index">
            <result name="success">/WEB-INF/pages/index.jsp</result>
        </action>

        <action name="signup" class="signupAction">
            <result name="cancel" type="redirect">/</result>
            <result name="input">/WEB-INF/pages/signup.jsp</result>
            <result name="success" type="chain">saveSignup</result>
        </action>

        <action name="saveSignup" class="signupAction" method="save">
            <result name="input">/WEB-INF/pages/signup.jsp</result>
            <result name="success" type="redirectAction">/mainMenu</result>
        </action>

        <action name="editUser" class="userAction" method="edit">
            <interceptor-ref name="adminCheck"/>
            <result name="success">/WEB-INF/pages/userForm.jsp</result>
            <result name="input">/WEB-INF/pages/admin/userList.jsp</result>
        </action>

        <action name="editProfile" class="userAction" method="edit">
            <result name="success">/WEB-INF/pages/userForm.jsp</result>
            <result name="error">/WEB-INF/pages/mainMenu.jsp</result>
        </action>

        <action name="saveUser" class="userAction" method="save">
            <result name="cancel" type="redirectAction">admin/users</result>
            <result name="input">/WEB-INF/pages/userForm.jsp</result>
            <result name="success" type="redirectAction">admin/users</result>
        </action>

        <action name="uploadFile" class="com.ogilvy.audi.webapp.action.FileUploadAction">
            <interceptor-ref name="fileUploadStack"/>
            <result name="input">/WEB-INF/pages/uploadForm.jsp</result>
            <result name="success">/WEB-INF/pages/uploadDisplay.jsp</result>
            <result name="cancel" type="redirectAction">mainMenu</result>
        </action>

        <action name="passwordHint" class="passwordHintAction">
            <result name="input">/</result>
            <result name="success">/</result>
        </action>

        



        

        <!--GuestUserAction-START-->
        <action name="guestUsers" class="com.ogilvy.audi.webapp.action.GuestUserAction" method="list">
            <result>/WEB-INF/pages/guestUserList.jsp</result>
        </action>

        <action name="editGuestUser" class="com.ogilvy.audi.webapp.action.GuestUserAction" method="edit">
            <result>/WEB-INF/pages/guestUserForm.jsp</result>
            <result name="error">/WEB-INF/pages/guestUserList.jsp</result>
        </action>

        <action name="saveGuestUser" class="com.ogilvy.audi.webapp.action.GuestUserAction" method="save">
            <result name="input">/WEB-INF/pages/guestUserForm.jsp</result>
            <result name="cancel" type="redirectAction">guestUsers</result>
            <result name="delete" type="redirectAction">guestUsers</result>
            <result name="success" type="redirectAction">guestUsers</result>
        </action>
        <!--GuestUserAction-END-->

        <!-- Add additional actions here -->
    </package>

    <!-- Actions in this package will be prefixed with /admin/ -->
    <package name="admin" extends="default" namespace="/admin">
        <action name="activeUsers" class="com.opensymphony.xwork2.ActionSupport">
            <result name="success">/WEB-INF/pages/admin/activeUsers.jsp</result>
        </action>
        
        <action name="reload" class="com.ogilvy.audi.webapp.action.ReloadAction">
            <interceptor-ref name="adminCheck"/>
            <!-- this should never be used, it's here to prevent warnings -->
            <result name="success">/WEB-INF/pages/mainMenu.jsp</result>
        </action>

        <action name="users" class="userAction" method="list">
            <interceptor-ref name="adminCheck"/>
            <result name="success">/WEB-INF/pages/admin/userList.jsp</result>
        </action>
    </package>
    <include file="circle-struts.xml"/>
</struts>
